From: Jonas Dreßler Date: Sun, 19 Jan 2020 22:20:02 +0000 (+0100) Subject: dialog: Split out _setLabel function X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~177 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=012dde3de966e62772b171362a2eb29102ff2fb2;p=gnome-shell.git dialog: Split out _setLabel function This will be useful when adding more generic containers like MessageDialogContent. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/935 --- diff --git a/js/ui/dialog.js b/js/ui/dialog.js index dfa656230..642873be6 100644 --- a/js/ui/dialog.js +++ b/js/ui/dialog.js @@ -3,6 +3,13 @@ const { Clutter, GObject, Pango, St } = imports.gi; +function _setLabel(label, value) { + label.set({ + text: value || '', + visible: value !== null, + }); +} + var Dialog = GObject.registerClass( class Dialog extends St.Widget { _init(parentActor, styleClass) { @@ -185,18 +192,12 @@ var MessageDialogContent = GObject.registerClass({ } set title(title) { - this._setLabel(this._title, 'title', title); + _setLabel(this._title, title); + this.notify('title'); } set description(description) { - this._setLabel(this._description, 'description', description); - } - - _setLabel(label, prop, value) { - label.set({ - text: value || '', - visible: value != null, - }); - this.notify(prop); + _setLabel(this._description, description); + this.notify('description'); } });